package com.atung.parking.enums;

import io.swagger.models.auth.In;
import lombok.Getter;

/**
 * @author wlt
 */

@Getter
public enum OrderState {
    PENDING_PAYMENT("待支付",201),
    PAID("已支付",202),
    USED("已使用",301),
    CANCELLED("已取消",203),
    REFUNDED("已退款",302);

    private final String description;
    private final Integer code;
    OrderState(String description,Integer code) {
        this.description = description;
        this.code=code;
    }
    public static String getDescriptionByCode(Integer code) {
        for (OrderState type : values()) {
            if (type.code.equals(code)) {
                return type.getDescription();
            }
        }
       return code.toString();
    }
    public String getDescription() {
        return description;
    }
}
